/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PostPanel.java
 *
 * Created on Sep 25, 2011, 2:09:13 PM
 */
package sdc;

import java.awt.Color;

/**
 *
 * @author Don
 */
public class PostPanel extends javax.swing.JPanel {

    /** Creates new form PostPanel */
    public PostPanel() {
        initComponents();
    }
    
    public void setText(Post post) {
        this.jtfUser.setText(post.user);
        this.jtaMessage.setText(post.message);
        this.jtfTimeDate.setText(post.time + " - " + post.number);
    }
    
    public void setSelected(boolean isSelected) {
        if (isSelected) {
            this.jtfUser.setBackground(Color.DARK_GRAY);
            this.jtfUser.setForeground(Color.WHITE);
            this.jtaMessage.setBackground(Color.DARK_GRAY);
            this.jtaMessage.setForeground(Color.WHITE);
        }
        else {
            this.jtfUser.setBackground(Color.WHITE);
            this.jtfUser.setForeground(Color.BLACK);
            this.jtaMessage.setBackground(Color.WHITE);
            this.jtaMessage.setForeground(Color.BLACK);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jtfUser = new javax.swing.JTextField();
        jtaMessage = new javax.swing.JTextArea();
        jtfTimeDate = new javax.swing.JTextField();

        setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
        setMinimumSize(new java.awt.Dimension(2, 2));
        setLayout(new java.awt.BorderLayout());

        jtfUser.setFont(new java.awt.Font("Tahoma", 1, 12));
        jtfUser.setText("User");
        jtfUser.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
        add(jtfUser, java.awt.BorderLayout.PAGE_START);

        jtaMessage.setColumns(20);
        jtaMessage.setFont(new java.awt.Font("Tahoma", 0, 12));
        jtaMessage.setLineWrap(true);
        jtaMessage.setRows(5);
        jtaMessage.setWrapStyleWord(true);
        jtaMessage.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 4, 4, 4));
        add(jtaMessage, java.awt.BorderLayout.CENTER);

        jtfTimeDate.setBackground(java.awt.SystemColor.controlHighlight);
        jtfTimeDate.setFont(new java.awt.Font("Tahoma", 2, 11));
        jtfTimeDate.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jtfTimeDate.setText("time and date");
        jtfTimeDate.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
        add(jtfTimeDate, java.awt.BorderLayout.PAGE_END);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea jtaMessage;
    private javax.swing.JTextField jtfTimeDate;
    private javax.swing.JTextField jtfUser;
    // End of variables declaration//GEN-END:variables
}
